local main = {}

function main.index(page)
    page:render('index')
end

function main.test(page)
    page:render('test')
end

function main.angular(page)

    local User = sailor.model("user")
	if next(page.POST) then
        local u = User:new()
        u.username = page.POST['user:username']
        u.password = page.POST['user:password']
        u:save()
        page:render('new',{user=u,form = form})
    else
        --us = User:find_all(username='xing')
        --page:render('list',{user=us})
        local user1 = {name='xing angular'}
        local user2 = {name='wang angular'}
        local users = {user1,user2}
        page:render('angular',{users = users})
    end
end

function main.test2(page)
    page:write("<h1>Finding tests </h1><br/>")
end
return main
